
<?php
$display = ($data->mail_sent != 1) ? '' : 'display:none';
$classcoursetyp = ($data->classes_id <> "") ? 'class' : 'course';
$classCourseId = ($data->classes_id <> "") ? $data->classes_id : $data->courses_id;
?>
<div class="table-content row">
    <hr>
    <div class="col-lg-2 col-md-2 col-sm-2 mopo"><?php echo $index + 1; ?></div>  
    <div class="col-lg-2 col-md-2 col-sm-2 mopo"><?php echo $data->name; ?></div>
    <div class="col-lg-2 col-md-2 col-sm-2 mopo"><?php if ($data->classes_id) echo $data->classes->class_titile; if ($data->courses_id) echo $data->courses->course_titile; ?></div>
    <div class="col-lg-2 col-md-2 col-sm-2 mopo"><?php echo date('M d Y', strtotime($data->created)); ?></div>
    <div class="col-lg-2 col-md-2 col-sm-2 mopo"><?php echo TimeAgo(convert_datetime($data->created)); ?></div>
    <div class="col-lg-2 col-md-2 col-sm-2 mopo"><?php echo ($data->mail_sent != 1) ? '<a href="javascript:void(0);" onclick="return showQuery(' . $data->id . ')">go to query</a>' : 'Converted'; ?><br>
        <?php echo ($data->mail_sent == '') ? 'Unresponded' : 'responded'; ?>
    </div>
</div>

<div style="display:none;" id="form_result_<?php echo $data->id; ?>">

    <div class='errorMessage formResult_<?php echo $data->id; ?>' style='margin:20px;'></div>
</div>
<div class="query-sec sendMessageTouserOpenBox"   style="display:none;" id="open_msg_box_<?php echo $data->id; ?>" >
    <hr>

    <div class="msgdetail">
        <h6>Message detail</h6>
        <?php echo $data->query; ?>
    </div>
    <div class="reply">
        <h6>Write a reply</h6>
        <input  title="subject" name="subject" id="subject_<?php echo $data->id; ?>" type="hidden" value="Query generated: name of <?php if ($data->classes_id) echo "Class " . $data->classes->class_titile; if ($data->courses_id) echo "Course " . $data->courses->course_titile; ?> | User Name: <?php echo $data->name; ?>">
        <textarea placeholder="" class="form-control book-control" id="message_text_<?php echo $data->id; ?>"></textarea>
        <div  class="errorMessage" id='errorMessage_msg_<?php echo $data->id; ?>'></div>
    </div>
    <div class="checkbox choice">
        <input type="checkbox" id="convert_<?php echo $data->id; ?>" onclick="updateConvert(<?php echo $data->id; ?>)"> 
        <label for="convert_<?php echo $data->id; ?>">convert user</label>
        <input type="hidden" id="convert_user_<?php echo $data->id; ?>" >
        <div class="query-loader" id="queryLoder_<?php echo $data->id; ?>" style="display: none"><img src="<?php echo ThemePath(); ?>/images/myskill.gif"></img></div>
        <input type="submit" value="submit" onclick="return replytousers(<?php echo $data->id; ?>,<?php echo $classCourseId; ?>,<?php echo $data->users_id; ?>, '<?php echo $classcoursetyp; ?>')">
        <input type="button" value="Cancle"  onclick="return hideQuery('<?php echo $data->id; ?>')" />
    </div>

</div>





